home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / berzerk.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  17KB  |  530 lines

  1. /***************************************************************************
  2.  
  3.  Berzerk Driver by Zsolt Vasvari
  4.  Sound Driver by Alex Judd
  5.  
  6. ***************************************************************************/
  7.  
  8. #include "driver.h"
  9. #include "vidhrdw/generic.h"
  10.  
  11. extern unsigned char* berzerk_magicram;
  12.  
  13. void berzerk_init_machine(void);
  14.  
  15. void berzerk_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  16.  
  17. int  berzerk_interrupt(void);
  18. WRITE_HANDLER( berzerk_irq_enable_w );
  19. WRITE_HANDLER( berzerk_nmi_enable_w );
  20. WRITE_HANDLER( berzerk_nmi_disable_w );
  21. READ_HANDLER( berzerk_nmi_enable_r );
  22. READ_HANDLER( berzerk_nmi_disable_r );
  23. READ_HANDLER( berzerk_led_on_r );
  24. READ_HANDLER( berzerk_led_off_r );
  25. READ_HANDLER( berzerk_voiceboard_r );
  26. WRITE_HANDLER( berzerk_videoram_w );
  27. WRITE_HANDLER( berzerk_colorram_w );
  28.  
  29. WRITE_HANDLER( berzerk_magicram_w );
  30. WRITE_HANDLER( berzerk_magicram_control_w );
  31. READ_HANDLER( berzerk_collision_r );
  32.  
  33. WRITE_HANDLER( berzerk_sound_control_a_w );
  34. int  berzerk_sh_start(const struct MachineSound *msound);
  35. void berzerk_sh_update(void);
  36.  
  37.  
  38. static unsigned char *nvram;
  39. static size_t nvram_size;
  40.  
  41. static void berzerk_nvram_handler(void *file,int read_or_write)
  42. {
  43.     if (read_or_write)
  44.         osd_fwrite(file,nvram,nvram_size);
  45.     else
  46.     {
  47.         if (file)
  48.             osd_fread(file,nvram,nvram_size);
  49.     }
  50. }
  51.  
  52.  
  53.  
  54. static struct MemoryReadAddress berzerk_readmem[] =
  55. {
  56.     { 0x0000, 0x07ff, MRA_ROM },
  57.     { 0x0800, 0x09ff, MRA_RAM },
  58.     { 0x1000, 0x3fff, MRA_ROM },
  59.     { 0x4000, 0x87ff, MRA_RAM },
  60.     { -1 }  /* end of table */
  61. };
  62.  
  63. static struct MemoryWriteAddress berzerk_writemem[] =
  64. {
  65.     { 0x0000, 0x07ff, MWA_ROM },
  66.     { 0x0800, 0x09ff, MWA_RAM, &nvram, &nvram_size },
  67.     { 0x1000, 0x3fff, MWA_ROM },
  68.     { 0x4000, 0x5fff, berzerk_videoram_w, &videoram, &videoram_size},
  69.     { 0x6000, 0x7fff, berzerk_magicram_w, &berzerk_magicram},
  70.     { 0x8000, 0x87ff, berzerk_colorram_w, &colorram},
  71.     { -1 }  /* end of table */
  72. };
  73.  
  74.  
  75. static struct MemoryReadAddress frenzy_readmem[] =
  76. {
  77.     { 0x0000, 0x3fff, MRA_ROM },
  78.     { 0x4000, 0x87ff, MRA_RAM },
  79.     { 0xc000, 0xcfff, MRA_ROM },
  80.     { 0xf800, 0xf9ff, MRA_RAM },
  81.     { -1 }  /* end of table */
  82. };
  83.  
  84. static struct MemoryWriteAddress frenzy_writemem[] =
  85. {
  86.     { 0x0000, 0x3fff, MWA_ROM },
  87.     { 0x4000, 0x5fff, berzerk_videoram_w, &videoram, &videoram_size},
  88.     { 0x6000, 0x7fff, berzerk_magicram_w, &berzerk_magicram},
  89.     { 0x8000, 0x87ff, berzerk_colorram_w, &colorram},
  90.     { 0xc000, 0xcfff, MWA_ROM },
  91.     { 0xf800, 0xf9ff, MWA_RAM },
  92.     { -1 }  /* end of table */
  93. };
  94.  
  95. static struct IOReadPort readport[] =
  96. {
  97.     { 0x44, 0x44, berzerk_voiceboard_r}, /* Sound stuff */
  98.     { 0x48, 0x48, input_port_0_r},
  99.     { 0x49, 0x49, input_port_1_r},
  100.     { 0x4a, 0x4a, input_port_2_r},
  101.     { 0x4c, 0x4c, berzerk_nmi_enable_r},
  102.     { 0x4d, 0x4d, berzerk_nmi_disable_r},
  103.     { 0x4e, 0x4e, berzerk_collision_r},
  104.     { 0x60, 0x60, input_port_3_r},
  105.     { 0x61, 0x61, input_port_4_r},
  106.     { 0x62, 0x62, input_port_5_r},
  107.     { 0x63, 0x63, input_port_6_r},
  108.     { 0x64, 0x64, input_port_7_r},
  109.     { 0x65, 0x65, input_port_8_r},
  110.     { 0x66, 0x66, berzerk_led_off_r},
  111.     { 0x67, 0x67, berzerk_led_on_r},
  112.     { -1 }  /* end of table */
  113. };
  114.  
  115.  
  116. static struct IOWritePort writeport[] =
  117. {
  118.     { 0x40, 0x46, berzerk_sound_control_a_w}, /* First sound board */
  119.     { 0x47, 0x47, IOWP_NOP}, /* not used sound stuff */
  120.     { 0x4b, 0x4b, berzerk_magicram_control_w},
  121.     { 0x4c, 0x4c, berzerk_nmi_enable_w},
  122.     { 0x4d, 0x4d, berzerk_nmi_disable_w},
  123.     { 0x4f, 0x4f, berzerk_irq_enable_w},
  124.     { 0x50, 0x57, IOWP_NOP}, /* Second sound board but not used */
  125.     { -1 }  /* end of table */
  126. };
  127.  
  128.  
  129. #define COINAGE(CHUTE) \
  130.     PORT_DIPNAME( 0x0f, 0x00, "Coin "#CHUTE ) \
  131.     PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) ) \
  132.     PORT_DIPSETTING(    0x0d, DEF_STR( 4C_3C ) ) \
  133.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) ) \
  134.     PORT_DIPSETTING(    0x0e, DEF_STR( 4C_5C ) ) \
  135.     PORT_DIPSETTING(    0x0a, DEF_STR( 2C_3C ) ) \
  136.     PORT_DIPSETTING(    0x0f, DEF_STR( 4C_7C ) ) \
  137.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) ) \
  138.     PORT_DIPSETTING(    0x0b, DEF_STR( 2C_5C ) ) \
  139.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) ) \
  140.     PORT_DIPSETTING(    0x0c, DEF_STR( 2C_7C ) ) \
  141.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) ) \
  142.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) ) \
  143.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) ) \
  144.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_7C ) ) \
  145.     PORT_DIPSETTING(    0x07, "1 Coin/10 Credits" ) \
  146.     PORT_DIPSETTING(    0x08, "1 Coin/14 Credits" ) \
  147.     PORT_BIT( 0xf0, IP_ACTIVE_LOW,  IPT_UNUSED )
  148.  
  149.  
  150. INPUT_PORTS_START( berzerk )
  151.     PORT_START      /* IN0 */
  152.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  153.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  154.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  155.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  156.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  157.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  158.  
  159.     PORT_START      /* IN1 */
  160.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  161.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  162.     PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
  163.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
  164.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  165.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  166.  
  167.     PORT_START      /* IN2 */
  168.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  169.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  170.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  171.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  172.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  173.     PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED )
  174.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  175.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  176.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  177.  
  178.     PORT_START      /* IN3 */
  179.     PORT_BITX(    0x01, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Input Test Mode", KEYCODE_F2, IP_JOY_NONE )
  180.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  181.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  182.     PORT_BITX(    0x02, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Crosshair Pattern", KEYCODE_F4, IP_JOY_NONE )
  183.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  184.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  185.     PORT_BIT( 0x3c, IP_ACTIVE_LOW,  IPT_UNUSED )
  186.     PORT_DIPNAME( 0xc0, 0x00, "Language" )
  187.     PORT_DIPSETTING(    0x00, "English" )
  188.     PORT_DIPSETTING(    0x40, "German" )
  189.     PORT_DIPSETTING(    0x80, "French" )
  190.     PORT_DIPSETTING(    0xc0, "Spanish" )
  191.  
  192.     PORT_START      /* IN4 */
  193.     PORT_BITX(    0x03, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Color Test", KEYCODE_F5, IP_JOY_NONE )
  194.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  195.     PORT_DIPSETTING(    0x03, DEF_STR( On ) )
  196.     PORT_BIT( 0x3c, IP_ACTIVE_LOW,  IPT_UNUSED )
  197.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) )
  198.     PORT_DIPSETTING(    0xc0, "5000 and 10000" )
  199.     PORT_DIPSETTING(    0x40, "5000" )
  200.     PORT_DIPSETTING(    0x80, "10000" )
  201.     PORT_DIPSETTING(    0x00, "None" )
  202.  
  203.     PORT_START      /* IN5 */
  204.     COINAGE(3)
  205.  
  206.     PORT_START      /* IN6 */
  207.     COINAGE(2)
  208.  
  209.     PORT_START      /* IN7 */
  210.     COINAGE(1)
  211.  
  212.     PORT_START      /* IN8 */
  213.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Free_Play ) )
  214.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  215.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  216.     PORT_BIT( 0x7e, IP_ACTIVE_LOW,  IPT_UNUSED )
  217.     PORT_BITX(0x80, IP_ACTIVE_HIGH, 0, "Stats", KEYCODE_F1, IP_JOY_NONE )
  218. INPUT_PORTS_END
  219.  
  220. INPUT_PORTS_START( frenzy )
  221.     PORT_START      /* IN0 */
  222.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  223.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  224.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  225.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  226.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  227.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  228.  
  229.     PORT_START      /* IN1 */
  230.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  231.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  232.     PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
  233.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  234.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  235.  
  236.     PORT_START      /* IN2 */
  237.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  238.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  239.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  240.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  241.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  242.     PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED )
  243.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  244.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  245.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  246.  
  247.     PORT_START      /* IN3 */
  248.     PORT_DIPNAME( 0x0f, 0x03, DEF_STR( Bonus_Life ) )
  249.     PORT_DIPSETTING(    0x01, "1000" )
  250.     PORT_DIPSETTING(    0x02, "2000" )
  251.     PORT_DIPSETTING(    0x03, "3000" )
  252.     PORT_DIPSETTING(    0x04, "4000" )
  253.     PORT_DIPSETTING(    0x05, "5000" )
  254.     PORT_DIPSETTING(    0x06, "6000" )
  255.     PORT_DIPSETTING(    0x07, "7000" )
  256.     PORT_DIPSETTING(    0x08, "8000" )
  257.     PORT_DIPSETTING(    0x09, "9000" )
  258.     PORT_DIPSETTING(    0x0a, "10000" )
  259.     PORT_DIPSETTING(    0x0b, "11000" )
  260.     PORT_DIPSETTING(    0x0c, "12000" )
  261.     PORT_DIPSETTING(    0x0d, "13000" )
  262.     PORT_DIPSETTING(    0x0e, "14000" )
  263.     PORT_DIPSETTING(    0x0f, "15000" )
  264.     PORT_DIPSETTING(    0x00, "None" )
  265.     PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED )
  266.     PORT_DIPNAME( 0xc0, 0x00, "Language" )
  267.     PORT_DIPSETTING(    0x00, "English" )
  268.     PORT_DIPSETTING(    0x40, "German" )
  269.     PORT_DIPSETTING(    0x80, "French" )
  270.     PORT_DIPSETTING(    0xc0, "Spanish" )
  271.  
  272.     PORT_START      /* IN4 */
  273.     PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )  /* Bit 0 does some more hardware tests */
  274.     PORT_BITX(    0x04, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Input Test Mode", KEYCODE_F2, IP_JOY_NONE )
  275.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  276.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  277.     PORT_BITX(    0x08, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Crosshair Pattern", KEYCODE_F4, IP_JOY_NONE )
  278.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  279.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  280.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  281.  
  282.     /* The following 3 ports use all 8 bits, but I didn't feel like adding all 256 values :-) */
  283.     PORT_START      /* IN5 */
  284.     PORT_DIPNAME( 0x0f, 0x01, "Coins/Credit B" )
  285.     /*PORT_DIPSETTING(    0x00, "0" )    Can't insert coins  */
  286.     PORT_DIPSETTING(    0x01, "1" )
  287.     PORT_DIPSETTING(    0x02, "2" )
  288.     PORT_DIPSETTING(    0x03, "3" )
  289.     PORT_DIPSETTING(    0x04, "4" )
  290.     PORT_DIPSETTING(    0x05, "5" )
  291.     PORT_DIPSETTING(    0x06, "6" )
  292.     PORT_DIPSETTING(    0x07, "7" )
  293.     PORT_DIPSETTING(    0x08, "8" )
  294.     PORT_DIPSETTING(    0x09, "9" )
  295.     PORT_DIPSETTING(    0x0a, "10" )
  296.     PORT_DIPSETTING(    0x0b, "11" )
  297.     PORT_DIPSETTING(    0x0c, "12" )
  298.     PORT_DIPSETTING(    0x0d, "13" )
  299.     PORT_DIPSETTING(    0x0e, "14" )
  300.     PORT_DIPSETTING(    0x0f, "15" )
  301.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH,  IPT_UNUSED )
  302.  
  303.     PORT_START      /* IN6 */
  304.     PORT_DIPNAME( 0x0f, 0x01, "Coins/Credit A" )
  305.     /*PORT_DIPSETTING(    0x00, "0" )    Can't insert coins  */
  306.     PORT_DIPSETTING(    0x01, "1" )
  307.     PORT_DIPSETTING(    0x02, "2" )
  308.     PORT_DIPSETTING(    0x03, "3" )
  309.     PORT_DIPSETTING(    0x04, "4" )
  310.     PORT_DIPSETTING(    0x05, "5" )
  311.     PORT_DIPSETTING(    0x06, "6" )
  312.     PORT_DIPSETTING(    0x07, "7" )
  313.     PORT_DIPSETTING(    0x08, "8" )
  314.     PORT_DIPSETTING(    0x09, "9" )
  315.     PORT_DIPSETTING(    0x0a, "10" )
  316.     PORT_DIPSETTING(    0x0b, "11" )
  317.     PORT_DIPSETTING(    0x0c, "12" )
  318.     PORT_DIPSETTING(    0x0d, "13" )
  319.     PORT_DIPSETTING(    0x0e, "14" )
  320.     PORT_DIPSETTING(    0x0f, "15" )
  321.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH,  IPT_UNUSED )
  322.  
  323.     PORT_START      /* IN7 */
  324.     PORT_DIPNAME( 0x0f, 0x01, "Coin Multiplier" )
  325.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  326.     PORT_DIPSETTING(    0x01, "1" )
  327.     PORT_DIPSETTING(    0x02, "2" )
  328.     PORT_DIPSETTING(    0x03, "3" )
  329.     PORT_DIPSETTING(    0x04, "4" )
  330.     PORT_DIPSETTING(    0x05, "5" )
  331.     PORT_DIPSETTING(    0x06, "6" )
  332.     PORT_DIPSETTING(    0x07, "7" )
  333.     PORT_DIPSETTING(    0x08, "8" )
  334.     PORT_DIPSETTING(    0x09, "9" )
  335.     PORT_DIPSETTING(    0x0a, "10" )
  336.     PORT_DIPSETTING(    0x0b, "11" )
  337.     PORT_DIPSETTING(    0x0c, "12" )
  338.     PORT_DIPSETTING(    0x0d, "13" )
  339.     PORT_DIPSETTING(    0x0e, "14" )
  340.     PORT_DIPSETTING(    0x0f, "15" )
  341.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH,  IPT_UNUSED )
  342.  
  343.     PORT_START      /* IN8 */
  344.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN3 )
  345.     PORT_BIT( 0x7e, IP_ACTIVE_LOW,  IPT_UNUSED )
  346.     PORT_BITX(0x80, IP_ACTIVE_HIGH, 0, "Stats", KEYCODE_F1, IP_JOY_NONE )
  347. INPUT_PORTS_END
  348.  
  349.  
  350.  
  351.  
  352. /* Simple 1-bit RGBI palette */
  353. static unsigned char palette[16 * 3] =
  354. {
  355.     0x00, 0x00, 0x00,
  356.     0xff, 0x00, 0x00,
  357.     0x00, 0xff, 0x00,
  358.     0xff, 0xff, 0x00,
  359.     0x00, 0x00, 0xff,
  360.     0xff, 0x00, 0xff,
  361.     0x00, 0xff, 0xff,
  362.     0xff, 0xff, 0xff,
  363.     0x40, 0x40, 0x40,
  364.     0xff, 0x40, 0x40,
  365.     0x40, 0xff, 0x40,
  366.     0xff, 0xff, 0x40,
  367.     0x40, 0x40, 0xff,
  368.     0xff, 0x40, 0xff,
  369.     0x40, 0xff, 0xff,
  370.     0xff, 0xff, 0xff
  371. };
  372. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  373. {
  374.     memcpy(game_palette,palette,sizeof(palette));
  375. }
  376.  
  377.  
  378.  
  379. static const char *berzerk_sample_names[] =
  380. {
  381.     "*berzerk", /* universal samples directory */
  382.     "",
  383.     "01.wav", // "kill"
  384.     "02.wav", // "attack"
  385.     "03.wav", // "charge"
  386.     "04.wav", // "got"
  387.     "05.wav", // "to"
  388.     "06.wav", // "get"
  389.     "",
  390.     "08.wav", // "alert"
  391.     "09.wav", // "detected"
  392.     "10.wav", // "the"
  393.     "11.wav", // "in"
  394.     "12.wav", // "it"
  395.     "",
  396.     "",
  397.     "15.wav", // "humanoid"
  398.     "16.wav", // "coins"
  399.     "17.wav", // "pocket"
  400.     "18.wav", // "intruder"
  401.     "",
  402.     "20.wav", // "escape"
  403.     "21.wav", // "destroy"
  404.     "22.wav", // "must"
  405.     "23.wav", // "not"
  406.     "24.wav", // "chicken"
  407.     "25.wav", // "fight"
  408.     "26.wav", // "like"
  409.     "27.wav", // "a"
  410.     "28.wav", // "robot"
  411.     "",
  412.     "30.wav", // player fire
  413.     "31.wav", // baddie fire
  414.     "32.wav", // kill baddie
  415.     "33.wav", // kill human (real)
  416.     "34.wav", // kill human (cheat)
  417.     0    /* end of array */
  418. };
  419.  
  420. static struct Samplesinterface berzerk_samples_interface =
  421. {
  422.     8,    /* 8 channels */
  423.     25,    /* volume */
  424.     berzerk_sample_names
  425. };
  426.  
  427. static struct CustomSound_interface custom_interface =
  428. {
  429.     berzerk_sh_start,
  430.     0,
  431.     berzerk_sh_update
  432. };
  433.  
  434.  
  435.  
  436. #define  frenzy_init_machine  0
  437.  
  438. #define DRIVER(GAMENAME,NVRAM)                                            \
  439.                                                                         \
  440. static struct MachineDriver machine_driver_##GAMENAME =                    \
  441. {                                                                        \
  442.     /* basic machine hardware */                                        \
  443.     {                                                                    \
  444.         {                                                                \
  445.             CPU_Z80,                                                    \
  446.             2500000,        /* 2.5 MHz */                                \
  447.             GAMENAME##_readmem,GAMENAME##_writemem,readport,writeport,    \
  448.             berzerk_interrupt,8                                            \
  449.         },                                                                \
  450.     },                                                                    \
  451.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */    \
  452.     1,    /* single CPU, no need for interleaving */                        \
  453.     GAMENAME##_init_machine,                                            \
  454.                                                                         \
  455.     /* video hardware */                                                \
  456.     256, 256, { 0, 256-1, 32, 256-1 },                                    \
  457.     0,                                                                    \
  458.     sizeof(palette) / sizeof(palette[0]) / 3, 0,                        \
  459.     init_palette,                                                        \
  460.                                                                         \
  461.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,                            \
  462.     0,                                                                    \
  463.     0,                                                                    \
  464.     0,                                                                    \
  465.     berzerk_vh_screenrefresh,                                            \
  466.                                                                         \
  467.     /* sound hardware */                                                \
  468.     0,0,0,0,                                                            \
  469.     {                                                                    \
  470.         {                                                                \
  471.             SOUND_SAMPLES,                                                \
  472.             &berzerk_samples_interface                                    \
  473.         },                                                                \
  474.         {                                                                \
  475.             SOUND_CUSTOM,    /* actually plays the samples */            \
  476.             &custom_interface                                            \
  477.         }                                                                \
  478.     },                                                                    \
  479.                                                                         \
  480.     NVRAM                                                                \
  481. };
  482.  
  483.  
  484. DRIVER(berzerk,berzerk_nvram_handler)
  485. DRIVER(frenzy,0)
  486.  
  487.  
  488.  
  489. /***************************************************************************
  490.  
  491.   Game driver(s)
  492.  
  493. ***************************************************************************/
  494.  
  495. ROM_START( berzerk )
  496.     ROM_REGION( 0x10000, REGION_CPU1 )
  497.     ROM_LOAD( "1c-0",         0x0000, 0x0800, 0xca566dbc )
  498.     ROM_LOAD( "1d-1",         0x1000, 0x0800, 0x7ba69fde )
  499.     ROM_LOAD( "3d-2",         0x1800, 0x0800, 0xa1d5248b )
  500.     ROM_LOAD( "5d-3",         0x2000, 0x0800, 0xfcaefa95 )
  501.     ROM_LOAD( "6d-4",         0x2800, 0x0800, 0x1e35b9a0 )
  502.     ROM_LOAD( "5c-5",         0x3000, 0x0800, 0xc8c665e5 )
  503. ROM_END
  504.  
  505. ROM_START( berzerk1 )
  506.     ROM_REGION( 0x10000, REGION_CPU1 )
  507.     ROM_LOAD( "rom0.1c",      0x0000, 0x0800, 0x5b7eb77d )
  508.     ROM_LOAD( "rom1.1d",      0x1000, 0x0800, 0xe58c8678 )
  509.     ROM_LOAD( "rom2.3d",      0x1800, 0x0800, 0x705bb339 )
  510.     ROM_LOAD( "rom3.5d",      0x2000, 0x0800, 0x6a1936b4 )
  511.     ROM_LOAD( "rom4.6d",      0x2800, 0x0800, 0xfa5dce40 )
  512.     ROM_LOAD( "rom5.5c",      0x3000, 0x0800, 0x2579b9f4 )
  513. ROM_END
  514.  
  515. ROM_START( frenzy )
  516.     ROM_REGION( 0x10000, REGION_CPU1 )
  517.     ROM_LOAD( "1c-0",         0x0000, 0x1000, 0xabdd25b8 )
  518.     ROM_LOAD( "1d-1",         0x1000, 0x1000, 0x536e4ae8 )
  519.     ROM_LOAD( "3d-2",         0x2000, 0x1000, 0x3eb9bc9b )
  520.     ROM_LOAD( "5d-3",         0x3000, 0x1000, 0xe1d3133c )
  521.     ROM_LOAD( "6d-4",         0xc000, 0x1000, 0x5581a7b1 )
  522.     /* 1c & 2c are the voice ROMs */
  523. ROM_END
  524.  
  525.  
  526.  
  527. GAME( 1980, berzerk,  0,       berzerk, berzerk, 0, ROT0, "Stern", "Berzerk (set 1)" )
  528. GAME( 1980, berzerk1, berzerk, berzerk, berzerk, 0, ROT0, "Stern", "Berzerk (set 2)" )
  529. GAME( 1982, frenzy,   0,       frenzy,  frenzy,  0, ROT0, "Stern", "Frenzy" )
  530.